<template>
	<view class="container">
		<jc-container ref='container' @setPageConfig='setPageConfig'></jc-container>
		<jcTabbarItem :current="currentTabbarIndex" :list='dynamicTabbar'></jcTabbarItem>
	</view>
</template>



<script>
	import {
		common
	} from '@/api/common.js'
	import {
		page
	} from '@/api/page.js'
	import {
		shop
	} from '@/api/shop.js'
	import {
		update
	} from '@/common/utils/update.js'
	import lesseeCell from "@/components/lesseeCell/lesseeCell.vue"
	import {
		getLocation
	} from '@/common/utils/getLocation.js'
	import jcTabbarItem from '@/components/jc-tabbarItem/index.vue'
	import {
		tabbarItem
	} from "@/api/tabbarItem.js"
	export default {
		components: {
			lesseeCell,
			jcTabbarItem,
		},
		data() {
			return {
				pageConfig: {},
				nodeList: [],
				dynamicTabbar: [],
				currentTabbarIndex: 0
			}
		},
		onLoad(options) {
			this.dynamicTabbar = this.$store.getters.getDynamicTabbar
			var	tabbars = this.dynamicTabbar.filter(item=>item.key == this.$Route.name)
			this.currentTabbarIndex = tabbars.length>=1?tabbars[0].sort:'0'
			this.$refs.container.pageName = this.$Route.name
			this.$refs.container.loadData()
		},
		onShow() {
			this.$refs.container.show()
		},
		onUnload() {
			
		},
		onPullDownRefresh() {
			this.$refs.container.pageName = this.$Route.name
			this.$refs.container.pullDownRefresh()
		},
		onReachBottom() {
			this.$refs.container.reachBottom()
		},
		onShareAppMessage(res) {
			return {
				title: '',
				path: this.$Route.path
			}
		},
		methods: {
			setPageConfig(pageConfig){
				uni.stopPullDownRefresh()
				this.pageConfig = pageConfig
				uni.setNavigationBarTitle({
					title: this.pageConfig.title
				})
				uni.setNavigationBarColor({
					backgroundColor: this.pageConfig.background,
					frontColor: (!this.pageConfig.navigationBarBackground || this.pageConfig.navigationBarBackground =='#FFF' || this.pageConfig.navigationBarBackground =='#fff' || this.pageConfig.navigationBarBackground =='#FFFFFF' || this.pageConfig.navigationBarBackground =='#ffffff')  ? "" : "#ffffff"
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.container{
		min-height: 100vh;
	}
</style>
